#/bin/sh

source /AIR_FLASH/system/air_sys.conf

killall -9 monitor.sh
killall -9 air_flash
killall -9 usb.sh
killall -9 bondCheck.sh

/AIR_FLASH/script/poe.sh on

POE=$1
GE=$2

ret=`ifconfig -a | grep $POE | wc -l`
if [ $ret -le 0 ] ; then
   echo "${POE} network interface not exist"
   exit
fi
ret=`ifconfig -a | grep $GE | wc -l`
if [ $ret -le 0 ] ; then
   echo "${GE} network interface not exist"
   exit
fi

ret=`ifconfig -a | grep bond0| wc -l`
if [ $ret -gt 0 ] ; then
    ifenslave -d bond0 $POE1
    ifenslave -d bond0 $POE2
    #ifconfig del bond0
    ifconfig bond0 down
fi

ret=`ifconfig -a | grep br0| wc -l`
if [ $ret -gt 0 ] ; then     
    brctl delbr br0
fi
#brctl addbr br0
#ifconfig br0 192.168.90.120 up
#brctl addif br0 ${POE}
#ifconfig ${POE} 192.168.90.121 up
#brctl addif br0 ${GE}
#ifconfig ${GE} 192.168.90.122 up

echo "bridging ${GE} ${POE} network"
brctl addbr br0
ifconfig br0 192.168.90.120 up
echo "create br0 network interface"
brctl addif br0 ${POE}
ifconfig ${POE} 192.168.90.121 up
echo "bridge br0 ${POE} network"
brctl addif br0 ${GE}
ifconfig ${GE} 192.168.90.122 up
echo "bridge br0 ${POE} ${GE} network"
echo "******************************************************************"
echo "******************TAU br0 ${GE} ${POE} UP OK********************"
echo "******************************************************************"
